/*
 * CharacterList.java
 *
 * Created on September 18, 2007, 10:56 AM
 */

package jia.editor.lists;

import jia.editor.EditorMain;
import jia.editor.forms.CharacterForm;
import jia.tools.PanelSwapper;

/**
 *
 * @author  estell
 */
public class pnl_CharacterList extends javax.swing.JPanel {
    
    /** Creates new form CharacterList */
    public pnl_CharacterList() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        pop_CharacterListOptions = new javax.swing.JPopupMenu();
        mnu_CharacterEdit = new javax.swing.JMenuItem();
        mnu_CharacterDelete = new javax.swing.JMenuItem();
        btn_CreateNew = new javax.swing.JButton();
        btn_CharacterEdit = new javax.swing.JButton();
        btn_CharacterDelete = new javax.swing.JButton();
        btn_CharacterCancel = new javax.swing.JButton();
        sp_CharacterListMain = new javax.swing.JSplitPane();
        scrl_CharacterTable = new javax.swing.JScrollPane();
        tbl_CharacterList = new javax.swing.JTable();
        scrl_CharacterDetails = new javax.swing.JScrollPane();
        txt_CharacterDetails = new javax.swing.JTextPane();

        mnu_CharacterEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/pencil.png")));
        mnu_CharacterEdit.setText("Edit Selected Character");
        pop_CharacterListOptions.add(mnu_CharacterEdit);

        mnu_CharacterDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/delete.png")));
        mnu_CharacterDelete.setText("Delete Selected Character");
        pop_CharacterListOptions.add(mnu_CharacterDelete);

        btn_CreateNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/add.png")));
        btn_CreateNew.setText("Add");
        btn_CreateNew.setPreferredSize(new java.awt.Dimension(132, 30));
        btn_CreateNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CreateNewActionPerformed(evt);
            }
        });

        btn_CharacterEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/pencil.png")));
        btn_CharacterEdit.setText("Edit");
        btn_CharacterEdit.setPreferredSize(new java.awt.Dimension(132, 30));

        btn_CharacterDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/delete.png")));
        btn_CharacterDelete.setText("Delete");
        btn_CharacterDelete.setPreferredSize(new java.awt.Dimension(132, 30));

        btn_CharacterCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jia_ui/images/door_out.png")));
        btn_CharacterCancel.setText(java.util.ResourceBundle.getBundle("jia_ui/images/formUI").getString("btn_Cancel_lbl"));
        btn_CharacterCancel.setToolTipText(java.util.ResourceBundle.getBundle("jia_ui/images/formUI").getString("btn_Cancel"));
        btn_CharacterCancel.setPreferredSize(new java.awt.Dimension(132, 30));
        btn_CharacterCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CharacterCancelActionPerformed(evt);
            }
        });

        sp_CharacterListMain.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1), java.util.ResourceBundle.getBundle("jia_ui/images/formUI").getString("title_Characters"), javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.BELOW_TOP));
        sp_CharacterListMain.setDividerLocation(400);
        sp_CharacterListMain.setDividerSize(7);
        sp_CharacterListMain.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        sp_CharacterListMain.setOneTouchExpandable(true);
        sp_CharacterListMain.setPreferredSize(new java.awt.Dimension(642, 558));
        tbl_CharacterList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Name", "Race", "Class", "Level"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        scrl_CharacterTable.setViewportView(tbl_CharacterList);

        sp_CharacterListMain.setTopComponent(scrl_CharacterTable);

        txt_CharacterDetails.setEditable(false);
        scrl_CharacterDetails.setViewportView(txt_CharacterDetails);

        sp_CharacterListMain.setRightComponent(scrl_CharacterDetails);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(sp_CharacterListMain, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(btn_CharacterCancel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(btn_CharacterEdit, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(btn_CharacterDelete, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(btn_CreateNew, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(21, 21, 21)
                        .add(btn_CreateNew, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btn_CharacterEdit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btn_CharacterDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 405, Short.MAX_VALUE)
                        .add(btn_CharacterCancel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(sp_CharacterListMain, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btn_CharacterCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CharacterCancelActionPerformed
        PanelSwapper.swap(EditorMain.p_defaultAdminPanel, this);
    }//GEN-LAST:event_btn_CharacterCancelActionPerformed

    private void btn_CreateNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CreateNewActionPerformed
       PanelSwapper.swap(new CharacterForm(), this);
    }//GEN-LAST:event_btn_CreateNewActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_CharacterCancel;
    private javax.swing.JButton btn_CharacterDelete;
    private javax.swing.JButton btn_CharacterEdit;
    private javax.swing.JButton btn_CreateNew;
    private javax.swing.JMenuItem mnu_CharacterDelete;
    private javax.swing.JMenuItem mnu_CharacterEdit;
    private javax.swing.JPopupMenu pop_CharacterListOptions;
    private javax.swing.JScrollPane scrl_CharacterDetails;
    private javax.swing.JScrollPane scrl_CharacterTable;
    private javax.swing.JSplitPane sp_CharacterListMain;
    private javax.swing.JTable tbl_CharacterList;
    private javax.swing.JTextPane txt_CharacterDetails;
    // End of variables declaration//GEN-END:variables
    
}
